
@echo off

if     "%1" == "clean" goto clean
if     "%1" == "slk" goto slk 
if     "%1" == "lr" goto lr
if     "%1" == "comp" goto comp
if     "%1" == "help" goto usage
if     "%1" == "" goto usage

:slk
%SLK%slk %2 %3 %4 -C++ calc.ll > Slk.out
goto comp

:lr
%SLK%slk %2 %3 %4 %5 -C++ -LR calc.lr > slk.out

:comp
icc -c calc.cpp SlkTree.cpp SlkParse.cpp SlkString.cpp scanner.cpp SlkError.cpp Slktoken.cpp SlkAction.cpp
ilink /map /ST:0x00200000 calc.obj SlkTree.obj SlkParse.obj SlkString.obj scanner.obj SlkError.obj Slktoken.obj SlkAction.obj
goto exit

:clean
	@rm -f *.obj
	@rm -f *.out
	@rm -f *.lst
	@rm -f *.err
	@rm -f *.map
        @rm -f *.def
        @rm -f *.exe
        @rm -f SlkString.*
        @rm -f SlkTable.*
        @rm -f SlkParse.*
        @rm -f SlkKeywords.*
        @rm -f SlkTerminals.h
        @rm -f SlkConstants.h
        @rm -f SlkExecute.txt
        @rm -f SlkState.*        
        @rm -f xxx*

goto exit

:usage
echo Usage:  mak [clean] [help] [comp] [slk] [lr] [flags]

:exit
